package com.yeepay.skb.biz;


import com.yeepay.skb.util.Conts;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 子账户信息查询
 */
public class CustomerInforQueryPartsBuilder extends YeepayBuilder{

    protected List<Part> parts=new ArrayList<Part>();
    protected String url= Conts.baseRequestUrl + "/customerInforQuery.action";
    private ArrayList<String> needHmac=new ArrayList<>(Arrays.asList("mainCustomerNumber",
            "mobilePhone",
            "customerNumber",
            "customerType"));

    public Part[] generateParams() {
        return parts.toArray(new Part[parts.size()]);
    }

    public CustomerInforQueryPartsBuilder setMainCustomerNumber(
            String mainCustomerNumber) {
        this.parts.add(new StringPart("mainCustomerNumber",
                mainCustomerNumber == null ? "" : mainCustomerNumber, "UTF-8"));
        return this;
    }

    public CustomerInforQueryPartsBuilder setMobilePhone(String mobilePhone) {
        this.parts.add(new StringPart("mobilePhone", mobilePhone == null ? ""
                : mobilePhone, "UTF-8"));
        return this;
    }

    public void setHmac(String hmac) {
        this.parts
                .add(new StringPart("hmac", hmac == null ? "" : hmac, "UTF-8"));
    }

    public CustomerInforQueryPartsBuilder setCustomerNumber(
            String customerNumber) {
        this.parts.add(new StringPart("customerNumber",
                customerNumber == null ? "" : customerNumber, "UTF-8"));
        return this;
    }

    public CustomerInforQueryPartsBuilder setCustomerType(String customerType) {
        this.parts.add(new StringPart("customerType", customerType == null ? ""
                : customerType, "UTF-8"));
        return this;
    }

    @Override
    public List<String> needHmacArr() {
        return needHmac;
    }

    public List<Part> getParts() {
        return parts;
    }

    @Override
    public String getUrl() {
        return url;
    }
}
